home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK2.toast / Development Kits / QuickTime / QuickTime 3 Interfaces & Libs / QTDevMac / CIncludes / Keyboards.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  3.7 KB  |  153 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Keyboards.h
  3.  
  4.      Contains:    Keyboard API.
  5.  
  6.      Version:    Technology:    Keyboard 1.0
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __KEYBOARDS__
  19. #define __KEYBOARDS__
  20.  
  21. #ifndef __MACTYPES__
  22. #include <MacTypes.h>
  23. #endif
  24.  
  25.  
  26.  
  27. #if PRAGMA_ONCE
  28. #pragma once
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_STRUCT_ALIGN
  40.     #pragma options align=mac68k
  41. #elif PRAGMA_STRUCT_PACKPUSH
  42.     #pragma pack(push, 2)
  43. #elif PRAGMA_STRUCT_PACK
  44.     #pragma pack(2)
  45. #endif
  46.  
  47. /*——————————————————————————————————————————————————————————————————————————————————*/
  48. /* Keyboard API constants                                                            */
  49. /*——————————————————————————————————————————————————————————————————————————————————*/
  50. /* Keyboard API Trap Number. Should be moved to Traps.i */
  51.  
  52. enum {
  53.     _KeyboardDispatch            = 0xAA7A
  54. };
  55.  
  56. /* Gestalt selector and values for the Keyboard API */
  57.  
  58. enum {
  59.     gestaltKeyboardsAttr        = FOUR_CHAR_CODE('kbds'),
  60.     gestaltKBPS2Keyboards        = 1,
  61.     gestaltKBPS2SetIDToAny        = 2,
  62.     gestaltKBPS2SetTranslationTable = 4
  63. };
  64.  
  65. /* Keyboard API Error Codes */
  66. /*
  67.    I stole the range blow from the empty space in the Allocation project but should
  68.    be updated to the officially registered range.
  69. */
  70.  
  71. enum {
  72.     errKBPS2KeyboardNotAvailable = -30850,
  73.     errKBIlligalParameters        = -30851,
  74.     errKBFailSettingID            = -30852,
  75.     errKBFailSettingTranslationTable = -30853,
  76.     errKBFailWritePreference    = -30854
  77. };
  78.  
  79.  
  80. /* Keyboard HW Layout Types */
  81.  
  82. enum {
  83.     kKeyboardJIS                = FOUR_CHAR_CODE('JIS '),
  84.     kKeyboardANSI                = FOUR_CHAR_CODE('ANSI'),
  85.     kKeyboardISO                = FOUR_CHAR_CODE('ISO '),
  86.     kKeyboardUnknown            = kUnknownType
  87. };
  88.  
  89.  
  90. /*——————————————————————————————————————————————————————————————————————————————————*/
  91. /* Keyboard API types                                                                */
  92. /*——————————————————————————————————————————————————————————————————————————————————*/
  93.  
  94.  
  95.  
  96. /*——————————————————————————————————————————————————————————————————————————————————*/
  97. /* Keyboard API routines                                                            */
  98. /*——————————————————————————————————————————————————————————————————————————————————*/
  99.  
  100. EXTERN_API( OSErr )
  101. KBInitialize                    (void)                                                        THREEWORDINLINE(0x303C, 0x0000, 0xAA7A);
  102.  
  103. EXTERN_API( OSErr )
  104. KBSetupPS2Keyboard                (short                     deviceID,
  105.                                  char *                    alternativeTable)                    THREEWORDINLINE(0x303C, 0x0001, 0xAA7A);
  106.  
  107. EXTERN_API( OSErr )
  108. KBGetPS2KeyboardID                (short *                deviceID)                            THREEWORDINLINE(0x303C, 0x0002, 0xAA7A);
  109.  
  110. EXTERN_API( Boolean )
  111. KBIsPS2KeyboardConnected        (void)                                                        THREEWORDINLINE(0x303C, 0x0003, 0xAA7A);
  112.  
  113. EXTERN_API( Boolean )
  114. KBIsPS2KeyboardEnabled            (void)                                                        THREEWORDINLINE(0x303C, 0x0004, 0xAA7A);
  115.  
  116. EXTERN_API( long )
  117. KBGetPS2KeyboardAttributes        (void)                                                        THREEWORDINLINE(0x303C, 0x0005, 0xAA7A);
  118.  
  119. EXTERN_API( OSErr )
  120. KBSetKCAPForPS2Keyboard            (Handle                 kcapHandle)                            THREEWORDINLINE(0x303C, 0x0006, 0xAA7A);
  121.  
  122. EXTERN_API( OSType )
  123. KBGetLayoutType                    (short                     deviceID)                            THREEWORDINLINE(0x303C, 0x0007, 0xAA7A);
  124.  
  125. EXTERN_API( OSErr )
  126. KBSetupPS2KeyboardFromLayoutType (OSType                 layoutType)                            THREEWORDINLINE(0x303C, 0x0008, 0xAA7A);
  127.  
  128. EXTERN_API( OSErr )
  129. KBGetPS2KeyboardLayoutType        (OSType *                layoutType)                            THREEWORDINLINE(0x303C, 0x0009, 0xAA7A);
  130.  
  131.  
  132.  
  133. #if PRAGMA_STRUCT_ALIGN
  134.     #pragma options align=reset
  135. #elif PRAGMA_STRUCT_PACKPUSH
  136.     #pragma pack(pop)
  137. #elif PRAGMA_STRUCT_PACK
  138.     #pragma pack()
  139. #endif
  140.  
  141. #ifdef PRAGMA_IMPORT_OFF
  142. #pragma import off
  143. #elif PRAGMA_IMPORT
  144. #pragma import reset
  145. #endif
  146.  
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150.  
  151. #endif /* __KEYBOARDS__ */
  152.  
  153.